//
//  UIBarButtonItem+Kylin_Item.m
//  03-BuDeJie-2 TabBar设置
//
//  Created by Kylin on 16/2/3.
//  Copyright © 2016年 kylin. All rights reserved.
//

#import "UIBarButtonItem+Kylin_Item.h"

@implementation UIBarButtonItem (Kylin_Item)
+ (UIBarButtonItem *)itemWithImage:(NSString *)image hightImage:(NSString *)hightIamge target:(id)target action:(SEL)action{
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    
    [button setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:hightIamge] forState:UIControlStateHighlighted];
    
    [button sizeToFit];
    
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[UIBarButtonItem alloc]initWithCustomView:button];
}
@end
